package cn.xiaopengstack.domain.award.repository;

import cn.xiaopengstack.domain.award.aggregate.GiveOutCreditAwardAggregate;
import cn.xiaopengstack.domain.award.aggregate.UserAwardOrderAggregate;
import cn.xiaopengstack.domain.award.model.entity.AwardEntity;
import cn.xiaopengstack.domain.award.model.entity.UserAwardRecordEntity;

import java.util.Optional;

/**
 * @author jiangyangang
 */
public interface IRaffleAwardRepository {

    /**
     * 保存用户抽奖奖品订单
     * @param orderAggregate
     */
    void createUserAwardOrder(UserAwardOrderAggregate orderAggregate);

    /**
     * 获取用户当前奖品中奖的次数
     * @param userId 用户ID
     * @param awardId 奖品ID
     * @return
     */
    int queryUserWinLotteryCount(String userId, Integer awardId);

    /**
     * 保存积分奖励订单
     * @param giveOutAwardAggregate
     */
    void saveGiveOutCreditAwardOrder(GiveOutCreditAwardAggregate giveOutAwardAggregate);

    /**
     * 查询
     * @param orderId
     * @return
     */
    Optional<UserAwardRecordEntity> queryAwardRecordByOrderId(String userId, String orderId);

    /**
     * 查询奖品信息
     * @param awardId
     * @return
     */
    Optional<AwardEntity> queryAwardEntity(Integer awardId);
}
